//
//  UIImage+Developer.m
//  yichangxing
//
//  Created by 小宇 on 2017/7/12.
//  Copyright © 2017年 cxkj. All rights reserved.
//

#import "UIImage+Developer.h"

@implementation UIImage (Developer)
- (UIImage *) imageWithTintColor:(UIColor *)tintColor
{
	//We want to keep alpha, set opaque to NO; Use 0.0f for scale to use the scale factor of the device’s main screen.
	UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f);
	[tintColor setFill];
	CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height);
	UIRectFill(bounds);

	//Draw the tinted image in context
	[self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0f];

	UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();

	return tintedImage;
}
@end
